//@json
function main(tbl){
	var urole=new HashSet();
	if(tbl.role_id||false){
		let menuids=dao.select(`select menu_id from sys_role_menu where role_id=${tbl.role_id}`,"set");
		urole.addAll(menuids)
	}
	let sql1=`select id,pid,name,url,icon,perms from sys_menu `;
	let list=dao.select(sql1)
	list.forEach(function(x){
		/*if(!isEmpty(x.perms))
		x.put("name",x.name+"<font color=\"#888\">&nbsp;&nbsp;&nbsp;" + x.perms + "</font>")*/
		if(urole.contains(x.id)){
			x.put("checked",true)
		}else{
			x.put("checked",false)
		}
		x.put("open",false);
		if(tbl.url){
			x.remove("url");
		}
		//x.put("nocheck",false);
	})
	let menus=Trees.menus(list)
	return menus;
}